package com.wsc.wisdomchina.activitity.fourmodule;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.wsc.wisdomchina.R;
import com.wsc.wisdomchina.Tools.JsonTools;
import com.wsc.wisdomchina.Tools.Tools;
import com.wsc.wisdomchina.activitity.Login_RegisterActivity;
import com.wsc.wisdomchina.activitity.baseactivity.BaseActivity;
import com.wsc.wisdomchina.application.MyApplication;
import com.wsc.wisdomchina.callback.ContributorView;
import com.wsc.wisdomchina.constant.Constant;
import com.wsc.wisdomchina.javaBean.ApplyDetailBean;
import com.wsc.wisdomchina.javaBean.RespObj;
import com.wsc.wisdomchina.presenter.ContributorPresenter;
import com.wsc.wisdomchina.view.MyToast;
import com.wsc.wisdomchina.view.NoEmojiEditText;
import com.wsc.wisdomchina.view.iphoneDialogBuilder;

/**
 * 住所地
 * Created by ${wangtao} on 2017/3/3.
 */

public class ZhuSuoDiActivity extends BaseActivity implements View.OnClickListener {
    private Context context;
    private ImageView regist_back;
    private TextView tv_headtitle;
    private TextView tv_sure;
    private String name;
    private NoEmojiEditText et_content;
    private MyToast myToast;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.zhusuodi_layout);
        context = this;
        myToast=new MyToast(context);
        name=getIntent().getStringExtra("name");
        initView();
    }

    private void initView() {
        regist_back=(ImageView) findViewById(R.id.regist_back);
        tv_headtitle=(TextView) findViewById(R.id.tv_headtitle);
        tv_sure=(TextView) findViewById(R.id.tv_sure);
        regist_back.setOnClickListener(this);
        tv_sure.setOnClickListener(this);
        tv_headtitle.setText(name);
        et_content=(NoEmojiEditText) findViewById(R.id.et_content);
        if(getIntent().getStringExtra("content")!=null)
        {
            et_content.setText(getIntent().getStringExtra("content"));
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.regist_back:
                finish();
                break;
            case R.id.tv_sure:
                String content=et_content.getText().toString().trim();
                if(content!=null && content.length()>0)
                {
                    View view = getWindow().peekDecorView();
                    if (view != null) {
                        InputMethodManager inputMethodManager = (InputMethodManager) getSystemService
                                (Context.INPUT_METHOD_SERVICE);
                        inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
                    }
                    Intent intent=getIntent();
                    intent.putExtra("content",content);
                    setResult(1,intent);
                    finish();
                }else
                {
                    myToast.showShort("输入内容不能为空");
                }

                break;
        }
    }
}
